import { CoolCommException } from "@cool-midway/core";
import { Rule, RuleType } from "@midwayjs/validate";
import { ModuleType } from "../entity/profile";

export class AddProviderProfileDTO {
    providerId: number
    name: string
    gender: number
    photo: string

}

export class SaveMyProfileDTO {

    @Rule(RuleType.string().optional().allow(''))
    wechat?: string;
    @Rule(RuleType.string().required().error(new CoolCommException('姓名不能为空')))
    name: string;
    @Rule(RuleType.number().required().error(new CoolCommException('性别不能为空')))
    gender: number;
    @Rule(RuleType.number().required().error(new CoolCommException('年龄不能为空')))
    age: number;
    @Rule(RuleType.string().required().error(new CoolCommException('照片不能为空')))
    photo: string;
    @Rule(RuleType.string().optional().allow(''))
    residence?: string;
    @Rule(RuleType.number().optional())
    teamId?: number;
    @Rule(RuleType.number().optional())
    experienceYears?: number;
    @Rule(RuleType.number().optional())
    drivingYears?: number;
    @Rule(RuleType.number().optional())
    serviceCount?: number;
    @Rule(RuleType.number().optional().default(5))
    comprehensiveScore?: number;


    @Rule(RuleType.string().optional().allow('').max(500).error(new CoolCommException('团队介绍不能超过500个字符')))
    teamIntroduction?: string;

    @Rule(RuleType.string().optional().allow('').max(500).error(new CoolCommException('介绍不能超过500个字符')))
    introduction?: string;
    @Rule(RuleType.array().items(RuleType.string().required()))
    serviceScope?: string[];

    @Rule(RuleType.object().keys({
        primaryColor: RuleType.string().optional().default('#000000'),
        secondaryColor: RuleType.string().optional().default('#000000'),
        backgroundColor: RuleType.string().optional().default('#000000'),
        backgroundImage: RuleType.string().optional().allow('').allow(null).default(null),
        fontColor: RuleType.string().optional().default('#000000'),
    }).optional().default({
        primaryColor: '#000000',
        secondaryColor: '#000000',
        backgroundColor: '#000000',
        backgroundImage: null,
        fontColor: '#000000',
    }))
    style?: {
        primaryColor?: string;
        secondaryColor?: string;
        backgroundColor?: string;
        backgroundImage?: string | null;
        fontColor?: string;
    };

    @Rule(RuleType.array().items(RuleType.string().required()))
    displayModule?: ModuleType[];

    @Rule(RuleType.string().optional().allow('').max(500).error(new CoolCommException('服务内容不能超过500个字符')))
    serviceContent?: string;

}